package com.fit.entities;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.tapestry5.beaneditor.NonVisual;
import org.apache.tapestry5.beaneditor.Validate;

@Entity
@Table(name = "sold_product")
public class Sold_product {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@NonVisual
	@Column(name = "id")
	private Long id;
	@NonVisual
	@Column(name = "date")
	private Date date;
	
	@Validate("required")
	@Column(name = "items_sold")
	private Long items_sold;
	
//	@NonVisual
//	@Column(name = "id_product")
//	private Long id_product;
	
	@Validate("required")
	@ManyToOne(optional = true)
	@JoinColumn(name = "id_user")
	private User user;
	
	@Validate("required")
	@ManyToOne(optional = true)
	@JoinColumn(name = "id_product")
	private Product product;
	
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public Product getProduct() {
		return product;
	}
	public void setProduct(Product product) {
		this.product = product;
	}
	public Long getItems_sold() {
		return items_sold;
	}
	public void setItems_sold(Long items_sold) {
		this.items_sold = items_sold;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}

	

}
